(comint-mode): Set comint-last-input-start and
authorRichard M. Stallman <rms@gnu.org>
Thu, 21 Apr 1994 06:42:24 +0000 (06:42 +0000)
committerRichard M. Stallman <rms@gnu.org>
Thu, 21 Apr 1994 06:42:24 +0000 (06:42 +0000)
comint-last-input-end to valid markers.

(comint-send-input): Use comint-output-filter to run
functions on comint-output-filter-functions.

(comint-kill-output): Use delete-region to remove, and
comint-output-filter to insert.

lisp/comint.el

index 29e73f13e120599bc5ff30e5485ae2eb88c099a0..a5b0cfe5b338a27fc3b83be00e691c419668d635 100644 (file)
@@ -346,8 +346,10 @@ Entry to this mode runs the hooks on `comint-mode-hook'."
   (use-local-map comint-mode-map)
   (make-local-variable 'comint-last-input-start)
   (setq comint-last-input-start (make-marker))
+  (set-marker comint-last-input-start (point-min))
   (make-local-variable 'comint-last-input-end)
   (setq comint-last-input-end (make-marker))
+  (set-marker comint-last-input-end (point-min))
   (make-local-variable 'comint-last-output-start)
   (setq comint-last-output-start (make-marker))
   (make-local-variable 'comint-prompt-regexp)        ; Don't set; default
@@ -1130,13 +1132,7 @@ Similarly for Soar, Scheme, etc."
          (set-marker comint-last-input-start pmark)
          (set-marker comint-last-input-end (point))
          (set-marker (process-mark proc) (point))
-         ;; A kludge to prevent the delay between insert and process output
-         ;; affecting the display.  A case for a comint-send-input-hook?
-         (if (eq (process-filter proc) 'comint-output-filter)
-             (let ((functions comint-output-filter-functions))
-               (while functions
-                 (funcall (car functions) (concat input "\n"))
-                 (setq functions (cdr functions)))))))))
+         (comint-output-filter proc "")))))
 
 ;; The purpose of using this filter for comint processes
 ;; is to keep comint-last-input-end from moving forward
@@ -1421,14 +1417,19 @@ your process from hanging on long inputs.  See `comint-send-string'."
   "Kill all output from interpreter since last input.
 Does not delete the prompt."
   (interactive)
-  (let ((pmark (progn (goto-char
-                      (process-mark (get-buffer-process (current-buffer))))
-                     (beginning-of-line nil)
-                     (point-marker))))
-    (kill-region comint-last-input-end pmark)
-    (insert "*** output flushed ***\n")
-    (comint-skip-prompt)
-    (set-marker pmark (point))))
+  (let ((proc (get-buffer-process (current-buffer)))
+       (replacement nil))
+    (save-excursion
+      (let ((pmark (progn (goto-char (process-mark proc))
+                         (beginning-of-line nil)
+                         (point-marker))))
+       (delete-region comint-last-input-end pmark)
+       (comint-skip-prompt)
+       (setq replacement (concat "*** output flushed ***\n"
+                                 (buffer-substring pmark (point))))
+       (delete-region pmark (point))))
+    ;; Output message and put back prompt
+    (comint-output-filter proc replacement)))
 
 (defun comint-show-output ()
   "Display start of this batch of interpreter output at top of window.